﻿function callServer() {
	$.ajax({
		url:"hkd2usd.cgi",
		data:"hkd=" + $("#hkd").val(),
		dataType:"html",
		type:"post",
		success:function(usd) {
			$("#usd").html($("#hkd").val() + " HKD = " + usd + " USD");
		},
		beforesend:function(h) {
			$("#usd").html("calculating...");
		}
	});
}

function setup() {
	$("#hkd").keyup(callServer);
}

$(document).ready(setup);